<template>
  <div class="index" id="policyDetails">
    <div class="contentTitle">
      <p class="titleName">{{datas.title}}</p>
      <span class="titleDetail"><p>发布时间：{{datas.updateTime}}</p></span>
    </div>
    <div class="content" v-html="datas.contents"></div>
  </div>
</template>
<script>
import {getPolicyDetail} from '@/api/service/service'
export default {
  name: "chooseProject",
  data: function () {
    return {
      loading: false,
      datas:{},            //列表
    };
  },
  mounted() {
    getPolicyDetail({id:this.getQueryString("id")}).then(res=>{
        let datas =  res.datas;
        datas.updateTime = this.renderTime(datas.updateTime)
        this.datas = datas;
         
     })
  },
  watch: {},

  methods: {
    getQueryString (name) { 
        let reg = `(^|&)${name}=([^&]*)(&|$)`
        let r = window.location.search.substr(1).match(reg); 
        if (r != null) return unescape(r[2]); return null; 
      },
      renderTime(date) {
      let datea = date.split(/[- : \/]/)
      return datea[0]+'年'+datea[1]+'月'+datea[2].slice(0,2)+"日"
    },
  },
};
</script>
<style scoped>
.index {
  background: #fff;
}
#policyDetails .contentTitle {
    display: -ms-flexbox;
    display: flex;
    min-height: 80px;
    -ms-flex-direction: column;
    flex-direction: column;
    -ms-flex-pack: center;
    justify-content: center;
    padding: 12px 15px 10px 15px;
    box-sizing: border-box;
    margin-bottom: 6px;
    background: #fff;
}
#policyDetails .titleName {
    width: 100%;
    font-size: 18px;
    color: #333;
    line-height: 24px;
    margin-bottom: 15px;
}
#policyDetails .titleDetail {
    width: 100%;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-align: center;
    align-items: center;
}
#policyDetails .titleDetail p {
    font-size: 12px;
    color: #999;
}
#policyDetails .titleDetail p {
    font-size: 12px;
    color: #999;
}
#policyDetails .content {
    background: #fff;
    padding: 20px 15px;
    box-sizing: border-box;
    font-size: 14px;
    color: #333;
    line-height: 22px;
    letter-spacing: .5px;
    word-break: break-word;
    white-space: pre-wrap;
}
</style>
